include("shared.lua")

Alpha = 255

function ENT:Initialize()
	self:SetColor( Color(112, 128, 144, 255) )
end

function ENT:Draw()
	self.Entity:DrawModel()
end

function ENT:OnRemove()
end

function ENT:Think()
end

blinded = false
local timers = false

usermessage.Hook("blind", function(um)
	if timers then return end
	timers = true
	blinded = um:ReadBool()
	timer.Simple( 5, function ()
		blinded = false
		timers = false	
	end)
end)

local Alpha = 0
hook.Add( "HUDPaint", "blind_hud", function()
	if blinded == true then 
		Alpha = math.min( Alpha + 10, 255 )
	else
		Alpha = math.max( Alpha - .5, 0 )
	end

	if (Alpha == 0) then return end
		surface.SetDrawColor( 255, 255, 255, Alpha )
		surface.DrawRect( 0, 0, ScrW(), ScrH() )
end)

